package com.xue.web.service;

import com.alibaba.fastjson.JSONObject;
import com.xue.web.dao.LeaveMessageDao;
import com.xue.web.entity.LeaveMessage;

import java.util.ArrayList;
import java.util.List;

public class LeaveMessageService {
    LeaveMessageDao leaveMessageDao =new LeaveMessageDao();
    public JSONObject doSelectMessage(){
        JSONObject jsonObject =new JSONObject();
        List<LeaveMessage>  leaveMessage = leaveMessageDao.selectMessage();
        String[] messages =new String[leaveMessage.size()];
        for (int i = 0; i <messages.length ; i++) {
            messages[i]=leaveMessage.get(i).getMessage();
        }

        jsonObject.put("messages",messages);

        return jsonObject;
    }
}
